package com.tech.tool.service.impl;

import com.tech.tool.constant.PageConstant;
import com.tech.tool.dataobject.ProjectInfo;
import com.tech.tool.enums.DeleteEnum;
import com.tech.tool.repository.ProjectInfoRepository;
import com.tech.tool.service.ProjectInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

@Service
public class ProjectInfoInfoServiceImpl implements ProjectInfoService {

    @Autowired
    private ProjectInfoRepository repository;

    @Override
    public Page<ProjectInfo> findByBu(Integer buId) {
        PageRequest pageRequest = PageRequest.of(PageConstant.PAGE_INDEX, PageConstant.PAGE_LIMIT);
        return repository.findByProjectDeleteAndBuId(DeleteEnum.EXIST.getCode(), buId, pageRequest);
    }
}
